<template>
    <NavBar :pageTitle="pageTitle"></NavBar>
    <div class="vote-container">
        <div class="item" v-for="item in list" :key="item.id">
            <image mode="widthFix" style="width: 200px;" :src="item.ticketImg" />

        </div>
    </div>
</template>
<script setup>
import { onMounted, ref } from "vue";
import Taro, { useDidShow } from "@tarojs/taro";
import * as indexApi from '../../api/index'
const pageTitle = ref("");
const router = Taro.useRouter();
const id = ref("");
const list = ref([])
useDidShow(() => {
    const currentPage = Taro.getCurrentPages().slice(-1)[0];
    const pageTitle1 = currentPage.config.navigationBarTitleText || "默认标题";
    pageTitle.value = pageTitle1;
    getListContainerHeight()

});
onMounted(() => {
    id.value = router.params.id
    getDetail()
});
const getDetail = async () => {
    const result = await indexApi.getOrderDetail({
        orderId: id.value
    })
    console.log(result, "result");
    if (result.state == 200) {
        list.value = result.data
    }
}
const listContainerHeight = ref(0)
const listContainerWidth = ref(0)
//计算页面高度
const getListContainerHeight = () => {
    const query = Taro.createSelectorQuery()
        .select(".vote-container")
        .boundingClientRect()
    query.selectViewport()
    query.exec(function (res) {
        if (res[0]) {
            listContainerHeight.value = res[0].height;
            listContainerWidth.value = res[0].width

        }
    });
}

</script>
<style lang="scss">
.page {
    height: 100%;

}

.vote-container {
    display: flex;
    height: 100%;
    padding: 30px 0;

    flex-direction: column;
    align-items: center;
    box-sizing: border-box;

    .fooster {
        display: flex;
        margin-top: 15px;

    }

    .vote-container-img:nth-child(n + 2) {
        margin-top: 20px;
    }

    .vote-container-img {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .nut-swiper-item {
        display: flex;
        align-items: center;
        justify-content: center;
        // img {
        //     width: 100%;
        //     height: auto;
        // }
    }

    .nut-swiper {
        touch-action: pan-y; // 添加这一行
    }

    .nut-swiper-btns {
        width: 100%;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1;
        display: flex;
        justify-content: space-between;
    }

    .nut-swiper-btns span {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 30px;
        // background-color: rgba(0, 0, 0, 0.2);
    }
}
</style>
